package com.lj.queue.result;

import cn.idev.excel.annotation.ExcelProperty;
import com.lj.queue.entity.DelayQueueMessage;
import com.lj.queue.enums.DelayQueueMessageStatus;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * <p>
 * 延迟队列消息表 excel导出参数
 * </p>
 *
 * @author lj
 * @since 2025-07-21 16:55:02
 */
@Data
public class DelayQueueMessageExportResult {

    /**
     * 消息内容
     */
    @ExcelProperty("消息内容")
    private String message;

    /**
     * 消息状态
     */
    @ExcelProperty(value = "消息状态")
    private DelayQueueMessageStatus status;

    /**
     * 预计时间
     */
    @ExcelProperty("预计时间")
    private LocalDateTime expectTime;

    public static DelayQueueMessageExportResult of(DelayQueueMessage entity) {
        if (entity == null) {
            return null;
        }
        DelayQueueMessageExportResult result = new DelayQueueMessageExportResult();
        result.setMessage(entity.getMessage());
        result.setStatus(entity.getStatus());
        result.setExpectTime(entity.getExpectTime());
        return result;
    }
}
